﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace BizTalkOneService.System
{
    internal class Kernel32Dll
    {
        private const string kernel32_dll = "kernel32.dll";

        ///
        /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa364937
        ///
        ///A directory on the disk.
        /// If this parameter is NULL, the function uses the root of the current disk.
        /// If this parameter is a UNC name, it must include a trailing backslash.
        ///Total number of free bytes on a disk that are available to the user who is associated with the calling thread.
        ///Total number of bytes on a disk that are available to the user who is associated with the calling thread.
        ///Total number of free bytes on a disk.
        /// Boolean indicating if the function succeeds.
        [DllImport(kernel32_dll, SetLastError = true, CharSet = CharSet.Auto)]
        public static extern bool GetDiskFreeSpaceEx(
            string lpDirectoryName,
            out ulong lpFreeBytesAvailable,
            out ulong lpTotalNumberOfBytes,
            out ulong lpTotalNumberOfFreeBytes
            );
    }
}